package fr.imag.adele.cprobes.impl;

import fr.imag.adele.cprobes.abstracts.AbstractProbe;
import fr.imag.adele.cprobes.services.DataCollector;
import fr.imag.adele.cprobes.services.DataSender;
import fr.imag.adele.cprobes.services.Scheduler;
import fr.imag.adele.cprobes.util.DataSet;

/**
 * The standard implementation of a the Probe Service
 * It just forward the receiving event from input to output.
 * It can play the role of a filter by just specifying different
 * outputs (provided resources) than inputs (required resources). 
 * 
 * @author Bassem DEBBABI
 *
 */
public class StandardProbe extends AbstractProbe {
	
	/**
	 * Process the collected data.
	 * In this standard implementation, the collected data is forwarded 
	 * directly to interested targets without treatment.
	 * So it just plays the role 
	 */
	
	public void process() {
		if (isWorking() == true){
            DataSet dataSet = getCollectedData(); 
            sendProcessedData(dataSet);
		}
	}
	
	////Binding methods
	// TODO if we can bind directly with methods from the parent class
	// then we have to move these methods to the parent class.
	
	public void bindScheduler(Scheduler scheduler) {			
		setScheduler(scheduler);
	}
	public void unbindScheduler() {
		setScheduler(null);
	}
	public void bindDataCollector(DataCollector dataCollector) {
		setDataCollector(dataCollector);
	}
	public void unbindDataCollector() {
		setDataCollector(null);
	}
	public void bindDataSender(DataSender dataSender) {
		setDataSender(dataSender);
	}
	public void unbindDataSender() {
		setDataSender(null);
	}
	
	////
}
